/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.reporte.modelo;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author 43579648
 */
@Entity
@Table(name = "CONEXION", catalog = "", schema = "APP")
@NamedQueries({
    @NamedQuery(name = "Conexion.findAll", query = "SELECT c FROM Conexion c"),
    @NamedQuery(name = "Conexion.findByIdConexion", query = "SELECT c FROM Conexion c WHERE c.idConexion = :idConexion"),
    @NamedQuery(name = "Conexion.findByNombre", query = "SELECT c FROM Conexion c WHERE c.nombre = :nombre"),
    @NamedQuery(name = "Conexion.findByDescripcion", query = "SELECT c FROM Conexion c WHERE c.descripcion = :descripcion")})
public class Conexion implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID_CONEXION", nullable = false)
    private Integer idConexion;
    @Basic(optional = false)
    @Column(name = "NOMBRE", nullable = false, length = 100)
    private String nombre;
    @Column(name = "DESCRIPCION", length = 200)
    private String descripcion;
    @OneToMany(mappedBy = "conexion")
    private List<Reporte> reporteList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "conexion")
    private List<DatoConexion> datoConexionList;

    public Conexion() {
    }

    public Conexion(Integer idConexion) {
        this.idConexion = idConexion;
    }

    public Conexion(Integer idConexion, String nombre) {
        this.idConexion = idConexion;
        this.nombre = nombre;
    }

    public Integer getIdConexion() {
        return idConexion;
    }

    public void setIdConexion(Integer idConexion) {
        this.idConexion = idConexion;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    public List<Reporte> getReporteList() {
        return reporteList;
    }

    public void setReporteList(List<Reporte> reporteList) {
        this.reporteList = reporteList;
    }

    public List<DatoConexion> getDatoConexionList() {
        return datoConexionList;
    }

    public void setDatoConexionList(List<DatoConexion> datoConexionList) {
        this.datoConexionList = datoConexionList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idConexion != null ? idConexion.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Conexion)) {
            return false;
        }
        Conexion other = (Conexion) object;
        if ((this.idConexion == null && other.idConexion != null) || (this.idConexion != null && !this.idConexion.equals(other.idConexion))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.reporte.modelo.Conexion[idConexion=" + idConexion + "]";
    }

}
